public class Seat {
    private int row;
    private int col;
    private boolean isSold;
    private String showId;
    private String ticketId;
    public Seat(int row, int col, String showId) {
        this.row = row;
        this.col = col;
        this.showId = showId;
        this.isSold = false;
        this.ticketId = null;
    }
    public boolean sell(String ticketId) {
        if (isSold) {
            return false;
        }
        this.isSold = true;
        this.ticketId = ticketId;
        return true;
    }
    public boolean refund(String ticketId) {
        if (!isSold || !this.ticketId.equals(ticketId)) {
            return false;
        }
        this.isSold = false;
        this.ticketId = null;
        return true;
    }
    public void reset(String newShowId) {
        this.showId = newShowId;
        this.isSold = false;
        this.ticketId = null;
    }
    public String getSeatLabel() {
        return row + "排" + col + "座";
    }
    public int getRow() {
        return row;
    }
    public int getCol() {
        return col;
    }
    public boolean isSold() {
        return isSold;
    }
    public String getShowId() {
        return showId;
    }
    public void setShowId(String showId) {
        this.showId = showId;
    }
    public String getTicketId() {
        return ticketId;
    }
    @Override
    public String toString() {
        return getSeatLabel() + "[" + (isSold ? "已售" : "空闲") + "]";
    }
}